﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CommendEdit.aspx.cs" Inherits="Course_CommendEdit" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>推荐课程</title>
    <link href="../../css/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../css/admin.css" rel="stylesheet" />
    <script src="../../js/jquery-1.7.2.min.js"></script>
    <script src="../../css/assets/js/bootstrap.min.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div id="menuRight">
                <br />
                推荐列表：
                    <div style="padding: 20px; border: 1px solid #D5D5D5;" id="meRight">
                        <asp:Literal runat="server" ID="litCommList"></asp:Literal>
                    </div>
            </div>
            <div>
                <asp:Button runat="server" ID="btnOK" Text="保存" CssClass="btn btn-primary btnSize" OnClick="btnOK_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Label runat="server" CssClass="txtWarn" ID="lblWarn"></asp:Label>
                <input type='hidden' runat="server" id="lblCommList" />
            </div>
        </div>
        <script>
            //计算checkboxlist高度
            $("#meLeft").height($("#meRight").height());
            BindCommList();
            //获取权限ID字符串
            function GetCommIDString() {
                var $iframe = $(self.parent.frames["frameContent"].document);
                var str = "";
                var commendList = $iframe.find("#meRight input");
                //var commendList = $("#meRight input");
                for (var i = 0; i < commendList.length; i++) {
                    if (commendList[i].checked == true) {
                        str += commendList[i].value + ",";
                    }
                }
                str = str.substring(0, str.length - 1);
                $iframe.find("#lblCommList").val(str);
            }

            //绑定权限列表
            function BindCommList() {
                var $iframe = $(self.parent.frames["frameContent"].document);
                var commendList = $iframe.find("#meRight input");
                var ls = $iframe.find("#lblCommList").val().split(",");
                for (var i = 0; i < commendList.length; i++) {
                    for (var j = 0; j < ls.length; j++) {
                        if (commendList[i].value == ls[j]) {
                            commendList[i].checked = true;                       
                        }
                    }
                }
            }
        </script>
    </form>

</body>
</html>
